<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
		<title></title>
		<script type="text/javascript" src="script/config.js"></script>
    <style>
			* {
				margin: 0;
				padding: 0;
			}
			body{
      	background-color:white;
      }
			.box {
				height: 100%;
				width: 100%;
				background-color: white;
			}

			.top {
				height: 50px;
				width: 100%;
				margin-top: 80px;
				text-align: center;
				font: 20px "微软雅黑";
				color: rgb(17,64,108);
			}

			.center {
				height: 230px;
				width: 100%;
				text-align: center;
			}

			.center2 {
				height: 32px;
				margin-top: 40px;
				/*line-height: 50px;*/
				text-align: center;
				width: 70%;
				color: #f16c3c;
				margin-left:15%;
				border-bottom:1px solid #f16c3c;
			}
			/*.center2 img{
				width:30px;
				height:30px;
				vertical-align:top;
				float:left;
			}*/
			.name_a{
				height:30px;
				vertical-align:top;
				float:left;
				margin-left:15px;
				margin-right:5px;
			}
			.mobile_a{
				height:30px;
				vertical-align:top;
				float:left;
				margin-left:20px;
				margin-right:8px;
			}
			.idcard_a{
				height:30px;
				vertical-align:top;
				float:left;
				margin-left:5px;
			}
			 ::-webkit-input-placeholder {
				/* WebKit browsers */
				color: rgb(138, 171, 202);
				font-size:18px;
			}
			.center2 input{
				height:32px;
				width:75%;
				border:none;
				list-style: none;
				outline-style: none;
				border: none;
				background: none;
				display: inline-block;
				float: left;
				margin-left: 10px;
				font-size:18px;
			}
			.foot{
				width:64%;
				margin-left:18%;
				height:44px;
				background-color:#f16c3c;
				line-height:44px;
				text-align: center;
				color:white;
				font-size:20px;
				border-radius: 10px;
			}
			input {
				-webkit-tap-highlight-color:transparent;
			}
		</style>
	</head>
	<body>
		<div class="box">
			<div class="top">第1步:请填写您的个人信息</div>
			<div class="center">
				<div class="center2">
					<img src="image/name.png" class="name_a"><input type="text" class="center2_1" placeholder="姓名" id="name">
				</div>
				<div class="center2">
					<img src="image/mobile.png" class="mobile_a"><input type="text" class="center2_1" placeholder="手机号" id="tel">
				</div>
				<div class="center2">
					<img src="image/identity_card.png" class="idcard_a"><input type="text" class="center2_1" placeholder="身份证号" id="idcard">
				</div>
			</div>
			<div class="foot" id="foot">下一步</div>
		</div>
	</body>
	<script type="text/javascript" src="script/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" src="script/local.js"></script>
	<script type="text/javascript" src="script/APICloud-rest.js"></script>
	<script type="text/javascript" src="script/api.js"></script>
	<!-- <script type="text/javascript" src="../script/up_check.js"></script> -->
	<script>
	apiready = function(){
  $api.val($api.dom('#tel'),'');
	$api.val($api.dom('#name'),'');
	$api.val($api.dom('#idcard'),'');
	$api.addEvt($api.dom('#foot'), 'click', function(){
		var user = $api.getStorage('user');
		if(user){
			var lorryid=user.lorryid;
			var time=user.time;
			check(lorryid,time);
		}


         var name=$api.val($api.dom('#name'));
          var mobile=$api.val($api.dom('#tel'));
          var idcard=$api.val($api.dom('#idcard'));
					if(name.length==0||(/(^\s+)|(\s+$)/g).test(name)){
						api.toast({
							 msg: '姓名不能为空或带有空格',
							 duration: 1000,
							location: 'middle'
						});
          }else if(mobile.length==0){
						api.toast({
               msg: '手机号不为空',
               duration: 1000,
              location: 'middle'
            });
					}else if(idcard.length==0){
						api.toast({
               msg: '身份证号不为空',
               duration: 1000,
              location: 'middle'
            });
					}else if(!(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(idcard))){
            api.toast({
               msg: '身份证号码不正确',
               duration: 1000,
              location: 'middle'
            });
          }else{
						$api.post(url+'app.php/match_user',{
               body:{
								 name:name,
								 mobile:mobile,
								 idcard:idcard,
							 }
               },function(ret){
								 if(ret.result==0){
									 api.openWin({
										 name: 'password_second',
										 url:  'password_second.html',
										  slidBackEnabled:false,
										 pageParam: {
											 name:name,
											 mobile:mobile,
											 idcard:idcard,
										 }
									 })
								 }else{
									 api.toast({
											msg: ret.desc,
											duration: 1000,
										 location: 'middle'
									 });
								 }

						},'json');

          }

          })
        }
				var check=function(id,time){
				  $api.post(url+'app.php/check',{
				        body:{lorryid:id,
				              time:time,}
				       },function(ret){
				        if(ret.result==4){
				          alert(ret.desc);
				          api.openWin({
				            name: 'index',
				            url:  'index.html',
				          });
				           setTimeout("api.closeWin({name:'main'})",650);
				           $api.rmStorage('password');
				           var key = 'user';
				           var user = {};
				           var aa=$api.getStorage(key);
				           user.lorryid=aa.lorryid;
				            user.telephone=aa.telephone;
				           user.flag= aa.flag
				           user.pass= '';
				           $api.setStorage(key, user);
				           api.alert({
				             title: '提示消息',
				             msg: ret.desc,
				             buttons: ['确定']
				           });
				         }else{
				          //  alert(ret.desc);
				         }
				       });
				}
	</script>
</html>
